<?php
/**
 * Created by PhpStorm.
 * User: coolinmind
 * Date: 01/03/2019
 * Time: 16:25
 */

namespace App\Services\UCenter;


use App\Services\UCenter\UCenter\CommentLogic;

class Comment
{
    /**
     * 发表评论
     * @param $data
     * @return array
     * @throws \App\Exceptions\RequestFailException
     */
    public function addComment($data)
    {
        $data = pick_array($data, ['user_id', 'waybill_id', 'content', 'role_ids']);
        ValidateComment::checkValidate($data, ['user_id', 'waybill_id', 'content', 'role_ids']);
        return (new CommentLogic())->addComment($data);
    }

    /**
     * 获取用户评价标签统计数据
     * @param $data
     * @return mixed
     * @throws \App\Exceptions\RequestFailException
     */
    public function getCommentStatistics($data)
    {
        $data = pick_array($data, ['user_id', 'role_ids']);
        ValidateComment::checkValidate($data, ['user_id', 'role_ids']);
        return (new CommentLogic())->getCommentStatistics($data);
    }
}
